import request from '@/utils/request'

const headlinesApi = {
    page: '/headlinesWeb/headlinesList',
    batchTop: '/headlinesWeb/batchIsTop',
    batchRecommend: '/headlinesWeb/batchIsRecommend',
    batchShow: '/headlinesWeb/batchIsShow',
    detail: '/headlinesWeb/headlinesDetail',
    delete: '/headlinesWeb/batchDelete',
    add: '/headlinesWeb/',
    update: '/headlinesWeb/',
};

export function page(params){
    return request({
        url: headlinesApi.page,
        method: 'get',
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        },
        params,
    });
} 

export function batchTop(params){
    return request({
        url: headlinesApi.batchTop,
        method: 'PUT',
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        },
        data: params,
    })
}

export function batchRecommend(params){
    return request({
        url: headlinesApi.batchRecommend,
        method: 'PUT',
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        },
        data: params,
    })
}

export function batchShow(params){
    return request({
        url: headlinesApi.batchShow,
        method: 'PUT',
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        },
        data: params,
    })
}



export function detail(params){
    return request({
        url: headlinesApi.detail,
        method: 'get',
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        },
        params,
    });
} 

export function batchDelete(data){
    return request({
        url: headlinesApi.delete,
        method: 'PUT',
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        },
        data,
    })
}

export function addNews(data){
    return request({
        url: headlinesApi.add,
        method: 'POST',
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        },
        data,
    })
}


export function updateNews(params){
    return request({
        url: headlinesApi.update,
        method: 'PUT',
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        },
        data: params,
    })
}